package com.aistar.service.impl;

import com.aistar.mapper.ShopMapper;
import com.aistar.pojo.Shop;
import com.aistar.service.ShopService;
import com.aistar.util.MyBatisUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import java.util.List;

public class ShopServiceImpl implements ShopService {
    @Override
    public PageInfo<Shop> getAll(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Shop> shopList=MyBatisUtil.getSqlSession().getMapper(ShopMapper.class).selectByExample(null);
        MyBatisUtil.closeSqlSession();
        return new PageInfo<Shop>(shopList);

    }

    @Override
    public Shop getById(String id) {
        return null;
    }

    @Override
    public List<Shop> getBySearchWord(Shop shop) {
        return MyBatisUtil.getSqlSession().getMapper(ShopMapper.class).selectBySearchWord(shop);

    }
}
